/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86187
 * Date: 2022-04-15
 * Time: 12:15
 */

//求两数最大公因数
import java.util.Scanner;

public class TestNode3 {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int b = scan.nextInt();
        int num = 0;

        for (int i = 1; i <= a && i <= b; i++) {

            if((a % i == 0) && (b % i == 0)) {
                num = i;
            }
        }
        //System.out.println(num);
        System.out.println("两个数的最大公因数为："+num);
    }
}
